#ifndef __CACHE_H__
#define __CACHE_H__
#include "common.h"

#define block_size_bit 6
#define block_size 64
typedef struct{
    uint32_t tag;
    uint8_t block[block_size];
    bool valid, dirty;
}block;

#define l1_ways 8
#define l1_sets_bit 7
#define l1_sets 1024/8
block l1_cache[l1_sets][l1_ways];
uint64_t l1_t;

#define l2_ways 16
#define l2_sets_bit 12
#define l2_sets (64 * 1024 / 16)
block l2_cache[l2_sets][l2_ways];
uint64_t l2_t;

void init_cache();
void p_cache_t();

#define l1_tag_bit 19

#define l2_tag_bit 14

int32_t l1_read(hwaddr_t addr);
int32_t l2_read(hwaddr_t addr);
void l1_write(hwaddr_t addr, size_t len, uint32_t data);
void l2_write(hwaddr_t addr, size_t len, uint32_t data);

#endif